/** 不再兼容非标准的数据结构 */
export declare type AjaxPromise<R> = Promise<R>
/** 非标准包裹 */
export declare type NonStandardAjaxPromise<R> = Promise<{
  code?: number
  message?: string
  data: R
}>
export interface ExtraFetchParams {
  /** extra data for extends */
  extra?: any
  /** 扩展请求头 */
  headers?: any
  /** cancel request */
  cancel?: Promise<string | undefined>
}
export interface WrappedFetchParams extends ExtraFetchParams {
  /** http method */
  method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS' | 'PATCH' | 'HEAD'
  url: string
  /** post json data */
  data?: any
  /** post form data */
  form?: any
  /** query data */
  query?: any
  /** header */
  header?: any
  /** path data */
  path?: any
}
export declare class Ajax {
  /** ajax 方法 */
  ajax({ method, url, data, form, query, header, extra, cancel, headers }: WrappedFetchParams, path?: string, basePath?: string): Promise<any>
  /** 接口传参校验 */
  check<V>(value: V, name: string): void
  /** 新 fetch 接口，>= 3.5.4 */
  // public autosFetch<S extends keyof AutosAPIS>(source: S, ...args: AutosAPIS[S][0]): Promise<AutosAPIS[S][1]> {
  //   const { isFile, opt, ...config } = (args[0] || {}) as AutosParams
  //   let { headers = {} } = opt || {}
  //   if (isFile) {
  //     headers = {
  //       ...headers,
  //       'Content-Type': 'multipart/form-data'
  //     }
  //   }
  //   const [method, url] = source.split(' ') as [WrappedFetchParams['method'], string]
  //   return this.ajax({
  //     ...config,
  //     ...opt,
  //     method,
  //     url: config.path ? url.replace(/(({[^}]+})|(:[^/:]+$)|(:[^:/]+))/g, (all) => config.path![all.replace(/[:{}]/g, '')] || '') : url,
  //     headers
  //   })
  // }
}
declare const _default: Ajax
export default _default
